package cn.ht.jywrwater.module.ht.dal.mysql.regionwateranalysis;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.regionwateranalysis.RegionWaterAnalysisDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.regionwateranalysis.vo.*;

/**
 * 区域用水分析统计 Mapper
 *
 * @author hzx
 */
@Mapper
public interface RegionWaterAnalysisMapper extends BaseMapperX<RegionWaterAnalysisDO> {

    default PageResult<RegionWaterAnalysisDO> selectPage(RegionWaterAnalysisPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RegionWaterAnalysisDO>()
                .eqIfPresent(RegionWaterAnalysisDO::getRegion, reqVO.getRegion())
                .eqIfPresent(RegionWaterAnalysisDO::getYear, reqVO.getYear())
                .eqIfPresent(RegionWaterAnalysisDO::getUserCount, reqVO.getUserCount())
                .eqIfPresent(RegionWaterAnalysisDO::getWaterCount, reqVO.getWaterCount())
                .eqIfPresent(RegionWaterAnalysisDO::getReadMeterCount, reqVO.getReadMeterCount())
                .eqIfPresent(RegionWaterAnalysisDO::getAttritionCount, reqVO.getAttritionCount())
                .eqIfPresent(RegionWaterAnalysisDO::getAttritionRate, reqVO.getAttritionRate())
                .betweenIfPresent(RegionWaterAnalysisDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RegionWaterAnalysisDO::getId));
    }

    default List<RegionWaterAnalysisDO> selectList(RegionWaterAnalysisExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<RegionWaterAnalysisDO>()
                .eqIfPresent(RegionWaterAnalysisDO::getRegion, reqVO.getRegion())
                .eqIfPresent(RegionWaterAnalysisDO::getYear, reqVO.getYear())
                .eqIfPresent(RegionWaterAnalysisDO::getUserCount, reqVO.getUserCount())
                .eqIfPresent(RegionWaterAnalysisDO::getWaterCount, reqVO.getWaterCount())
                .eqIfPresent(RegionWaterAnalysisDO::getReadMeterCount, reqVO.getReadMeterCount())
                .eqIfPresent(RegionWaterAnalysisDO::getAttritionCount, reqVO.getAttritionCount())
                .eqIfPresent(RegionWaterAnalysisDO::getAttritionRate, reqVO.getAttritionRate())
                .betweenIfPresent(RegionWaterAnalysisDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RegionWaterAnalysisDO::getId));
    }

}
